<template>
	<view class="all-main">
		<view class="main">
			<view class="lists">
				<view v-for="(item, index) in lists" :key="index" class="items" @click="pathTo(item)">
					<view class="title">
						<view class="lefts">
							<u-icon name="account-fill" color="#2979ff" size="26"></u-icon>
							<view class="accounts">
								<view class="accountName">
									<text>{{item.title}}</text>
								</view>
								<view class="agentNo">
									<text>{{item.agent_no}}</text>
								</view>
							</view>
						</view>
						<view class="rights">
							<u-icon name="arrow-right" size="15"></u-icon>
						</view>
					</view>
					<view class="total">
						<view class="total-item-head">
							<view class="tags"></view>
							<view class="month">
								<text>本月</text>
							</view>
							<view class="last-month">
								<text>上月/累计</text>
							</view>
						</view>
						<view class="total-item border-bottom">
							<view class="tags">
								<text>交易</text>
							</view>
							<view class="month">
								<text class="values">{{item.month.money}}</text>
								<text v-if="item.month.unit!=''" class="units">({{item.month.unit}})</text>
							</view>
							<view class="last-month">
								<text class="values">{{item.last_month.money}}</text>
								<text v-if="item.last_month.unit!=''" class="units">({{item.last_month.unit}})</text>
							</view>
						</view>
						<view class="total-item border-bottom">
							<view class="tags">
								<text>商户</text>
							</view>
							<view class="month">
								<text class="values">{{item.month.binds}}</text>
								<text class="units">(个)</text>
							</view>
							<view class="last-month">
								<text class="values">{{item.last_month.binds}}</text>
								<text class="units">(个)</text>
							</view>
						</view>
						<view class="total-item">
							<view class="tags">
								<text>激活</text>
							</view>
							<view class="month">
								<text class="values">{{item.month.active}}</text>
								<text class="units">(台)</text>
							</view>
							<view class="last-month">
								<text class="values">{{item.last_month.active}}</text>
								<text class="units">(台)</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				lists: [],
				page: 1,
				bottom: true,
			}
		},
		onLoad() {
			this.loadData()
		},
		methods: {
			// 加载数据
			async loadData() {
				uni.showLoading({
					title: '加载中'
				});
				const {
					data: res
				} = await this.$myHttp({
					url: 'v1/getAccountDataTotal',
					data: {
						page: this.page,
						page_size: 15
					}
				});
				uni.hideLoading()
				if (res.code == 200) {
					this.lists = res.data
				}
			},
			// 调整详情
			pathTo(item) {
				uni.navigateTo({
					url: '/pages/hzy/shareholder/frameworks/total?agent_no=' + item.agent_no
				})
			},
		}
	}
</script>

<style lang="scss">
	.all-main {
		.main {
			padding: 30rpx;
			
			.lists {
				.items {
					background-color: #ffffff;
					border-radius: 10rpx;
					box-shadow: 7px 0px 30px -18px #888888;
					padding: 20rpx;
					margin-bottom: 30rpx;
					
					.title {
						border-left: 10rpx solid #2979ff;
						border-bottom: 1px solid #f4f4f5;
						display: flex;
						justify-content: space-between;
						align-items: center;
						
						.lefts {
							display: flex;
							padding-left: 10rpx;
							align-items: center;
							
							.accountName {
								padding-top: 10rpx;
								font-weight: bold;
								font-size: 28rpx;
							}
							
							.agentNo {
								padding-top: 10rpx;
								padding-bottom: 20rpx;
								padding-left: 20rpx;
								color: #909399;
								font-size: 28rpx;
							}
							
							text {
								padding-left: 10rpx;
							}
						}
					}
					
					.total {
						
						.total-item-head {
							display: flex;
							padding: 20rpx;
							text-align: right;
							font-weight: bold;
							border-bottom: 1px dashed #f4f4f5;
							
							.tags {
								width: 10%;
							}
							
							.month {
								width: 45%;
								color: #2979ff;
							}
							
							.last-month {
								width: 45%;
								color: #ff9900;
							}
						}
						
						.total-item {
							display: flex;
							padding: 0 20rpx;
							padding-top: 20rpx;
							
							.tags {
								width: 10%;
								font-size: 28rpx;
							}
							
							.month {
								width: 45%;
								text-align: right;
							}
							
							.last-month {
								width: 45%;
								text-align: right;
							}
							
							.values {
								font-weight: bold;
							}
							
							.units {
								font-size: 24rpx;
								color: #909399;
							}
						}
						
						.border-bottom {
							border-bottom: 1px dashed #f4f4f5;
							padding-bottom: 20rpx;
						}
					}
				}
			}
		}
	}
</style>
